#ifndef SERIALWIDGET_H
#define SERIALWIDGET_H

#include <iostream>
#include <stdio.h>   /* Standard input/output definitions */
#include <string.h>  /* String function definitions */
#include <unistd.h>  /* UNIX standard function definitions */
#include <fcntl.h>   /* File control definitions */
#include <sys/ioctl.h>
#include <errno.h>   /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */

#include <QtOpenGL/QGLWidget>
#include <QWidget>
using namespace std;

/** \brief Functions for sending and recieving serial commands from the manipulator */
class SerialWidget:public QWidget {
    Q_OBJECT

public:
    SerialWidget(QWidget *parent = 0);
    ~SerialWidget();

    int fd; // file descriptor for the port
    int correctCommands; // counts number of correctly executed commands
    int incorrectCommands;


public slots:
    void sendCommand(QString);
    void receiveStatus();
    void setBaudRate(int fd);

signals:

protected:

private:

    char command[50];
    char CR;

};


#endif // SERIALWIDGET_H
